package astnode;

public class VariableNode extends IDFactorNode{
	private ExpressionNode exp = null;
	private String arrayBase = "";
	
	public VariableNode( int lineNum ) { super(lineNum); }
	
	public VariableNode( IDFactorNode factor ){
		super( factor );
	}

	public ExpressionNode getIndex() {
		return exp;
	}

	public void setIndex(ExpressionNode exp) {
		this.exp = exp;
	}


	public String getArrayBase() {
		return arrayBase;
	}

	public void setArrayBase(String arrayBase) {
		this.arrayBase = arrayBase;
	}
	
	public boolean isArray(){
		DeclarationNode dec = this.getDeclaration();
		if( dec instanceof VariableDeclarationNode ){
			return ((VariableDeclarationNode) dec).isArray();
		}else{
			return ((ParameterNode)dec).isArray();
		}
	}

}
